package com.ny.service.impl;

import com.ny.entity.Device;
import com.ny.mapper.DeviceMapper;
import com.ny.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * 设备
 */
@Service
public class DeviceServiceImpl implements DeviceService {

    @Autowired
    private DeviceMapper deviceMapper;

    @Override
    public List<Device> findAllDevices() {
        return deviceMapper.findAllDevices();
    }

    @Override
    public List<Device> findDevicesByName(String name) {
        return deviceMapper.findDevicesByName(name);
    }

    @Override
    public int deleteDeviceById(int id) {
        return deviceMapper.deleteDeviceById(id);
    }

    @Override
    public boolean existsById(int id) {
        return deviceMapper.findDeviceById(id) != null;
    }
}

